﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WindowsFormsApplication.General;

namespace WindowsFormsApplication
{
    /*
     * TODO: 
     * 1. RobinBar in folded state. Disable and enable button then unfold the Robinbar.
     *    it will be retangle with orange border which 
     * 2. TreeView Context Menu float problem. -- Done
     */
    public partial class RadRobinBar : Form
    {
        public RadRobinBar()
        {
            InitializeComponent();
        }

        private void RadRobinBar_Load(object sender, EventArgs e)
        {
            try
            {
                radRibbonBar1.Expanded = false;

                treeView1.BeginUpdate();
                for (int i = 0; i < 10000; i++)
                {
                    treeView1.Nodes.Add("Parent " + i);
                    for (int j = 0; j < 30; j++)
                    {
                        treeView1.Nodes[i].Nodes.Add("Child " + j);
                    }
                }
                treeView1.EndUpdate();

                this.radRibbonBar1.ExpandedStateChanged += new EventHandler(radRibbonBar1_ExpandedStateChanged);
            }
            catch (Exception ex)
            {

            }
        }

        private void radRibbonBar1_ExpandedStateChanged(object sender, EventArgs e)
        {
            this.radRibbonBar1.ElementTree.ApplyThemeToElementTree();
        }

        private void RadRobinBar_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.B && e.Control)
            {
                radButtonElement1.Enabled = false;
            }
            else if (e.KeyCode == Keys.A && e.Control)
            {
                radButtonElement1.Enabled = true;
            }
            else if (e.KeyCode == Keys.C && e.Control)
            {
            }
            
        }


        private void treeView1_ContextMenuOpening(object sender, Telerik.WinControls.UI.TreeViewContextMenuOpeningEventArgs e)
        {
            e.Menu.Items.Clear();
            e.Menu.Items.AddRange();
        }

        private void radDropDownList1_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
        {
            radDropDownList2.SelectedIndex = 1;
        }

        private void radDropDownList2_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
        {
            radDropDownList2.SelectedIndex = 1;
        }

        private void radButton1_Click(object sender, EventArgs e)
        {
            //StringBuilder sb = new StringBuilder();
            //for (int i = 0; i < tableLayoutPanel1.ColumnCount; i++)
            //{
            //    for (int j = 0; j < tableLayoutPanel1.RowCount; j++)
            //    {
            //        Control c = tableLayoutPanel1.GetControlFromPosition(i, j);
            //        sb.AppendLine(c.Name);
            //    }
            //}
            //MessageBox.Show(sb.ToString());

            RadDropDownListTable rt = new RadDropDownListTable();

            rt.Rd1.SelectedIndex = 1;
        }

        bool abc = true;
        private void radCheckBox1_ToggleStateChanging(object sender, Telerik.WinControls.UI.StateChangingEventArgs args)
        {
            //if (abc)
            //{

            //}
            //else
            //{
            //    args.Cancel = true;
            //    abc = true;
            //}
        }

        private void radCheckBox1_MouseDown(object sender, MouseEventArgs e)
        {
            //if (e.Button == System.Windows.Forms.MouseButtons.Right)
            //{
            //    abc = false;
            //}
            
        }

        private void radCheckBox1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {

            }
            else
            {
                return;
            }
        }
    }
}
